from selenium import webdriver
from unit_729.Page.Page import Page
import unittest,time,pytest
from unit_729.db.db import db
class Test(unittest.TestCase):
    #测试固件 TestFixture
    def setUp(self):
        self.msq=db(username='root',password='yidong666',host='10.59.9.12',database='a3mall')
        self.driver = webdriver.Chrome()
        self.driver.maximize_window()
    def tearDown(self):
        time.sleep(10)
        self.driver.quit()
    def test_A3mall_01(self):
        po = Page(self.driver)
        # po.A3mall_search_01()
        po.luoji_01_login()
        all_price=po.all_price()
        all_prices=str(all_price).replace('￥ ','')
        assert '1333.32' in all_prices
        print(all_prices)
        dy1=po.duanyan()
        print(dy1)
        self.assertEqual(dy1,'欢迎回来，15821860061')
        # self.assertEqual('str(dy1)','您好, 15821860061 欢迎回来！')  # add assertion here
        yq1=self.msq.select(" select amount from mall_users where username = '15821860061'")
        print(yq1[0][0])
if __name__ == '__main__':
    unittest.main()